// PART 2 Meta-Regression Analysis TABLE 9

clear
set more off
set type double
graph drop _all
program drop _all
set scheme s2mono
//log using "\\C:\Users\XUE XINDONG\Desktop\part2 educ_health_20191007.smcl", replace
use "C:\Users\XUE XINDONG\Desktop\educ_health\meta_educ_health(20190928).dta"


******************************************************************************
*DEFINITION OF BASIC VARIABLES
******************************************************************************
gen tstat=tstatistics
gen negative = 1
replace negative = -1 if BadHealth == 1 & BadEduc == 0
replace negative = -1 if BadHealth == 0 & BadEduc == 1
replace tstat = tstat*negative
gen df = n-k1
gen r = tstat/sqrt(tstat^2+df)
gen varR = (1-r^2)/df
gen seR = sqrt(varR)
gen pcc = r
gen abststat = abs(tstat)
gen abspcc = abs(pcc)

******************************************************************************
*Kicking out outliers
******************************************************************************
reg pcc seR
predict resid, residual
egen stdr=std(resid)
gen absr=abs(stdr)
ta absr if absr>3.5
drop if absr>3.5
drop resid stdr absr

******************************************************************************
* Characteristics of the data
******************************************************************************
// Characteristics of health variables

summ PhysicalHealth1 Mentalhealth1 Generalhealth1 

// Types of Health variable

ge health_adl=[Health_NNN=="ADL"]
ge health_general=[Health_NNN=="SRH"]
ge health_depression=[Health_NNN=="depression"]
ge health_disease=[Health_NNN=="disease"]
ge health_mortality=[Health_NNN=="mortality"]
ge health_obesity=[Health_NNN=="obesity"]


sum health_general health_adl  health_disease health_mortality  health_obesity health_depression  Selfreported

// Characteristics of Educ variables
ta NameofEduc
ge Educdummy=(CategoryofEduc=="d")
sum Educdummy
ta CategoryofEduc
replace CategoryofEduc="d" if  CategoryofEduc=="D"


//Education level

ge educ_primary=[educ_n=="primary"] 
ge educ_secondary=[educ_n=="secondary"]
ge educ_tertiary=[educ_n=="university"]
ge educ_yschool=[CategoryofEduc=="c"]

sum educ_primary  educ_secondary  educ_tertiary  educ_yschool
 

//Number of Educavariables

summ NumberofEducvariables


// Dummy variables for Region/country
ge Region="Europe" if Country_new=="Denmark"
replace Region="Europe" if Country_new=="EU"
replace Region="Europe" if Country_new=="Finland"
replace Region="Europe" if Country_new=="France"
replace Region="Europe" if Country_new=="Germany"
replace Region="Europe" if Country_new=="Iceland"
replace Region="Europe" if Country_new=="Ireland"
replace Region="Europe" if Country_new=="Italy"
replace Region="Europe" if Country_new=="Turkey"
replace Region="Europe" if Country_new=="Netherland"
replace Region="Europe" if Country_new=="Norway"
replace Region="Europe" if Country_new=="Spain"
replace Region="Europe" if Country_new=="Sweden"
replace Region="UK" if Country_new=="UK"
replace Region="USA" if Country_new=="US"
replace Region="Asia" if  Country_new=="Japan"| Country_new=="Korea"| Country_new=="Indonesia"| Country_new=="Pakistan"
replace Region="China" if Country_new=="China"
replace Region="OECD" if Country_new=="OECD" 
replace Region="other" if Region=="OECD" 
replace Region="transnation" if Country_new=="transnational" 
summ Region

// Dummy variables for Region/country
ge Europe=[Region=="Europe"|Region=="UK" ]
ge US=[Region=="USA" | Country_new=="Canada"| Country_new=="Mexico"|]
ge Asia=[Region=="Asia"|Region=="China" | Country_new=="Australia" ]
ge country_other=[Region=="other"|Region=="transnation"]

sum US  Europe Asia country_other


//Income Level
ge Income_level="High" if Region=="Europe" |Region=="OECD" |Country_new=="US" |Country_new=="UK"| Country_new=="Canada"| Country_new=="Japan"| Country_new=="Korea"|Country_new=="Australia" | Country_new=="OECD"
replace Income_level="Mid-Low" if Country_new=="China" | Country_new=="Indonesia"| Country_new=="Pakistan"| Country_new=="Mexico"
replace Income_level="transnation" if Country_new=="transnational"

ge High_income=(Income_level=="High")
sum High_income


// Characteristics of the data
sum Individualdata Aggregatedata

sum CrossSectional Panel


// Wholesample vs. subsample
sum Wholepopulation
ge sample_female=[subsample_n=="female" ]
ge sample_male=[subsample_n=="male"]
ge sample_age25to50=[subsample_n=="age25-50"]
ge sample_age50above=[subsample_n=="age50+"]
ge sample_other=[subsample_n=="othertype"|subsample_n=="January and Febrary Born" |subsample_n=="high SES"| subsample_n=="low SES"]

sum  Wholepopulation sample_female   sample_male sample_age25to50 sample_age50above sample_other

// Control Variables
summ Age gender Race  MaritalStatus Income Occupation

// Estimation Method
gen Other1 = 1- OLS- FGLS- ProbitLogit-  OrderedProbitLogit- ORHR- HLM- IV2slsivprobitGMM- FixedEffect -regressiondiscontinuity- ExperimentQuasi_experiment 
replace Other1=1 if Other1==-1
summ OLS  ORHR FGLS ProbitLogit  OrderedProbitLogit HLM IV2slsivprobitGMM FixedEffect regressiondiscontinuity ExperimentQuasi_experiment Other1

//Endogeneity
ge endogeneity=(IV2slsivprobitGMM==1|FixedEffect==1 | regressiondiscontinuity==1 |ExperimentQuasi_experiment)
summ endogeneity

// T Calculation
ge Tcalculatedbypvalue = (TcalculatedbyPvalue == 1)

ge TcalculatedbyCI=(CILowerBound!=.&  CIUpperBound!=. )

ge Tcalculatedbynormal= 1 -Tcalculatedbypvalue - TcalculatedbyCI

sum   Tcalculatedbynormal TcalculatedbyCI  Tcalculatedbypvalue 

//Std.Err.
summ SEOLS SEOther

// non-journal study
gen njournal = (Published==0)
sum njournal

// Pubyear
sum PubYear

// JournalRank: Citescore of Scopus
gen Journalrank=.
replace Journalrank=6.16   if JournalName=="American Economic Journal:Applied Economics"
replace Journalrank=5.46   if JournalName=="American Economic Review"
replace Journalrank=2.63   if JournalName=="China Economic Review"
replace Journalrank=1.85   if JournalName=="Demographic Research"
replace Journalrank=3.23   if JournalName=="Demography"
replace Journalrank=2.46   if JournalName=="Economics and Human Biology"
replace Journalrank=2.25   if JournalName=="Economics of Education Review"
replace Journalrank=1.07   if JournalName=="Education Economics"
replace Journalrank=5.31   if JournalName=="European journal of epidemiology"
replace Journalrank=2.21   if JournalName=="Health Economics"
replace Journalrank=2.26   if JournalName=="Int J Public Health"
replace Journalrank=5.27   if JournalName=="International Journal of Epidemiology"
replace Journalrank=5.32   if JournalName=="Journal of Internal Medicine"
replace Journalrank=2.54   if JournalName=="Journal of Public Economics"
replace Journalrank=1.64   if JournalName=="Journal of population economics"
replace Journalrank=1.58   if JournalName=="Labour Economics"
replace Journalrank=3.32   if JournalName=="Population and Development Review"
replace Journalrank=3.72   if JournalName=="Preventive Medicine"
replace Journalrank=2.43   if JournalName=="Social Science Research"
replace Journalrank=1.99   if JournalName=="The Journal of Development studies"
replace Journalrank=8.27   if JournalName=="The Journal of Human Resources"
replace Journalrank=0.05   if JournalName=="The Pakistan Development Review"
replace Journalrank=2.25   if JournalName=="economics of education review"
replace Journalrank=3.71   if JournalName=="Social Science & Medicine"
replace Journalrank=7.06   if JournalName=="American Sociological Review"
replace Journalrank=1.14    if JournalName=="Applied Economics"
replace Journalrank=0.77    if JournalName=="Applied economics letters"
replace Journalrank=0.54    if JournalName=="Eastern Economic Journal"
replace Journalrank=2.25    if JournalName=="Econnomics of Eduction Review"
replace Journalrank=0       if JournalName=="Economics Perspectives"
replace Journalrank=1      if JournalName=="International Journal of Health Economics and Management"
replace Journalrank=0.54    if JournalName=="Journal of Economic analysis & policy"
replace Journalrank=4.1    if JournalName=="Journal of Health Economics"
replace Journalrank=0.31    if JournalName=="OECD Journal:Economic Studies"
replace Journalrank=3.32    if JournalName=="Population and Development Review "
replace Journalrank=4.7    if JournalName=="Review of Economics Studies"
replace Journalrank=1.71    if JournalName=="Scand. J. of Economics"
replace Journalrank=3.32    if JournalName=="American Journal of Epidemiology"
replace Journalrank=2.25   if JournalName=="Economics of Education Review"
replace Journalrank=2.1   if JournalName=="Journal of Human Capital"
replace Journalrank=4.9   if JournalName=="Journal of Labor Economics"
replace Journalrank=8.58   if JournalName=="PNAS"
replace Journalrank=0 if Published==0
sum Journalrank

//Journaltype
gen Journaltype=JournalName
replace Journaltype="economics"   if JournalName=="American Economic Journal:Applied Economics"
replace Journaltype="economics"   if JournalName=="American Economic Review"
replace Journaltype="economics"   if JournalName=="China Economic Review"
replace Journaltype="population & development"   if JournalName=="Demographic Research"
replace Journaltype="population & development"     if JournalName=="Demography"
replace Journaltype="economics"   if JournalName=="Economics and Human Biology"
replace Journaltype="economics"   if JournalName=="Economics of Education Review"
replace Journaltype="economics"   if JournalName=="Education Economics"
replace Journaltype="public health & medicine"    if JournalName=="European journal of epidemiology"
replace Journaltype="economics"     if JournalName=="Health Economics"
replace Journaltype="public health & medicine"     if JournalName=="Int J Public Health"
replace Journaltype="public health & medicine"     if JournalName=="International Journal of Epidemiology"
replace Journaltype="public health & medicine"      if JournalName=="Journal of Internal Medicine"
replace Journaltype="economics"   if JournalName=="Journal of Public Economics"
replace Journaltype="economics"   if JournalName=="Journal of population economics"
replace Journaltype="economics"   if JournalName=="Labour Economics"
replace Journaltype="population & development"     if JournalName=="Population and Development Review"
replace Journaltype="public health & medicine"    if JournalName=="Preventive Medicine"
replace Journaltype="sociology"   if JournalName=="Social Science Research"
replace Journaltype="population & development"  if JournalName=="The Journal of Development studies"
replace Journaltype="economics"   if JournalName=="The Journal of Human Resources"
replace Journaltype="population & development"  if JournalName=="The Pakistan Development Review"
replace Journaltype="economics"   if JournalName=="economics of education review"
replace Journaltype="sociology"   if JournalName=="Social Science & Medicine"
replace Journaltype="sociology"   if JournalName=="American Sociological Review"
replace Journaltype="economics"    if JournalName=="Applied Economics"
replace Journaltype="economics"     if JournalName=="Applied economics letters"
replace Journaltype="economics"     if JournalName=="Eastern Economic Journal"
replace Journaltype="economics"     if JournalName=="Econnomics of Eduction Review"
replace Journaltype="economics"        if JournalName=="Economics Perspectives"
replace Journaltype="economics"       if JournalName=="International Journal of Health Economics and Management"
replace Journaltype="economics"     if JournalName=="Journal of Economic analysis & policy"
replace Journaltype="economics"     if JournalName=="Journal of Health Economics"
replace Journaltype="economics"     if JournalName=="OECD Journal:Economic Studies"
replace Journaltype="population & development"    if JournalName=="Population and Development Review "
replace Journaltype="economics"     if JournalName=="Review of Economics Studies"
replace Journaltype="economics"     if JournalName=="Scand. J. of Economics"

replace Journaltype="public health & medicine"    if JournalName=="American Journal of Epidemiology" 
replace Journaltype="economics"     if JournalName=="Journal of Human Capital"
replace Journaltype="economics"     if JournalName=="Journal of Labor Economics"

ge journal_economics=[Journaltype=="economics"]
ge journal_sociology=[Journaltype=="sociology" ]
ge journal_develop=[Journaltype=="population & development" ]
ge journal_publichealth=[ Journaltype=="public health & medicine"] 
ge journal_science=[ Journaltype=="PNAS"] 

sum   journal_economics journal_sociology    journal_develop  journal_publichealth journal_science 


// Calculating study weights
bysort ID: egen numberests = count(ID)
tabulate numberests 
gen weight = 1/numberests




// Generating transformed variables for FE and RE
gen fetstatR = r/seR
metareg r seR , wsse(seR)
scalar tau2 =  e(tau2)
gen revarR = varR + tau2
gen reseR = sqrt(revarR)
gen retstatR = r/reseR
gen repubbiasR = seR/reseR

***********************************************
******META-REGRESSION ANALYSIS*****************
***********************************************

************ FIXED EFFECTS *******************

gen conss = 1/seR
ge health_adll=health_adl/seR  
ge health_diseasee=health_disease/seR 
ge health_mortalityy=health_mortality/seR 
ge health_obesityy=health_obesity/seR
ge health_depressionn=health_depression/seR
ge Selfreportedd=Selfreported/seR

gen educ_primaryy=educ_primary/seR
gen educ_secondaryy=educ_secondary/seR
gen educ_tertiaryy=educ_tertiary/seR
gen educ_yschooll=educ_yschool/seR

gen   NumberofEducvariabless= NumberofEducvariables/seR



gen Europee = Europe/seR
gen Asiaa = Asia/seR
gen country_otherr=country_other/seR
gen High_incomee = High_income/seR


ge Individualdataa=Individualdata/seR
ge panell = Panel/seR

ge  sample_femalee= sample_female/seR
ge  sample_malee=sample_male/seR 
ge  sample_age25to500=sample_age25to50/seR 
ge  sample_age50abovee=sample_age50above/seR 
ge  sample_otherr=sample_other/seR

ge Agee=Age/seR
ge genderr=gender/seR
ge Racee=Race/seR
ge MaritalStatuss= MaritalStatus/seR
ge Incomee=Income/seR
ge Occupationn= Occupation/seR

ge ORHRR=ORHR/seR  
ge FGLSS= FGLS/seR
ge ProbitLogitt= ProbitLogit/seR 
ge HLMM=HLM/seR
ge OrderedProbitLogitt= OrderedProbitLogit/seR
ge IV2slsivprobitGMMM= IV2slsivprobitGMM/seR
ge FixedEffectt= FixedEffect/seR 
ge regressiondiscontinuityy= regressiondiscontinuity/seR 
ge ExperimentQuasi_experimentt= ExperimentQuasi_experiment /seR
ge Other11=Other1/seR 


gen endogeneityy= endogeneity/seR

gen tci =  TcalculatedbyCI/seR
gen tpvalue = Tcalculatedbypvalue/seR
gen SEOtherr = SEOther/seR


gen njournall=njournal/seR

gen journal_economicss=journal_economics/seR
gen journal_sociologyy=journal_sociology/seR  
gen journal_developp=journal_develop/seR 
gen journal_publichealthh=journal_publichealth/seR
gen journal_sciencee=journal_science/seR


*** journal_economicss  journal_sociologyy   journal_developp  journal_publichealthh  journal_sciencee 

gen Journalrankk=Journalrank/seR
gen pubyearr = PubYear/seR


// NOTE: The constant term is the SER term

//////////////////////////////////////////////
//////////////  FIXED EFFECTS  ///////////////
//////////////////////////////////////////////

// THIS SECTION GIVES EQUAL WEIGHT TO EACH OBSERVATION

*--------------------------------------------------------*
*   TABLE: FixedEffects(Weight1) // Stepwise Regression  *
*--------------------------------------------------------*

// Here we use backwards stepwise regression selecting on the best regression using the BIC criterion
// We lock in the 4 spillover variables and the Cons variable: Spill_ind Spill_reg Spill_FDI Spill_ex 

qui regress fetstatR conss    health_adll  health_diseasee health_mortalityy  health_obesityy health_depressionn  Selfreportedd   ///
educ_secondaryy  educ_tertiaryy  educ_yschooll  NumberofEducvariabless    Europee Asiaa country_otherr  High_incomee ///
Individualdataa  panell   sample_femalee   sample_malee sample_age25to500 sample_age50abovee sample_otherr  Agee genderr Racee ///
MaritalStatuss Incomee Occupationn   endogeneityy  tci tpvalue SEOther ///
journal_economicss  journal_sociologyy   journal_developp  journal_publichealthh  journal_sciencee Journalrankk  pubyearr   
gen esample = e(sample)

vselect fetstatR   health_adll  health_diseasee health_mortalityy  health_obesityy health_depressionn     Selfreportedd   educ_secondaryy  educ_tertiaryy  educ_yschooll  NumberofEducvariabless  ///
Europee Asiaa  country_otherr  High_incomee Individualdataa    sample_femalee   sample_malee ///
sample_age25to500 sample_age50abovee sample_otherr  Agee genderr Racee  MaritalStatuss Incomee Occupationn   ///
tci  SEOther    Journalrankk journal_economicss  journal_sociologyy   journal_developp  journal_publichealthh  journal_sciencee  pubyearr,   ///
backward bic fix(conss    endogeneityy)

regress fetstatR conss    health_adll  health_diseasee  ///
Selfreportedd   educ_yschooll  NumberofEducvariabless  Europee Asiaa  country_otherr   ///
Individualdataa sample_femalee   sample_malee sample_otherr ///
Agee genderr Racee ///
MaritalStatuss endogeneityy  tci ///
journal_economicss journal_sociologyy  journal_sciencee Journalrankk  pubyearr   if esample == 1, vce(cluster ID)


// THIS SECTION GIVES EQUAL WEIGHT TO EACH STUDY

*--------------------------------------------------------*
*   TABLE: FixedEffects(Weight2) // Stepwise Regression  *
*--------------------------------------------------------*

// Here we use backwards stepwise regression selecting on the best regression using the BIC criterion
drop esample
qui regress fetstatR conss    health_adll  health_diseasee health_mortalityy  health_obesityy health_depressionn  Selfreportedd   ///
educ_secondaryy  educ_tertiaryy  educ_yschooll  NumberofEducvariabless    Europee Asiaa country_otherr  High_incomee ///
Individualdataa  panell   sample_femalee   sample_malee sample_age25to500 sample_age50abovee sample_otherr  Agee genderr Racee ///
MaritalStatuss Incomee Occupationn   endogeneityy  tci tpvalue SEOther ///
journal_economicss  journal_sociologyy   journal_developp  journal_publichealthh  journal_sciencee Journalrankk  pubyearr   [pweight = weight] 
gen esample = e(sample)

vselect fetstatR   health_adll  health_diseasee health_mortalityy  health_obesityy health_depressionn    Selfreportedd   educ_secondaryy  educ_tertiaryy  educ_yschooll  NumberofEducvariabless  ///
Europee Asiaa  country_otherr  High_incomee Individualdataa    sample_femalee   sample_malee ///
sample_age25to500 sample_age50abovee sample_otherr  Agee genderr Racee  MaritalStatuss Incomee Occupationn   ///
tci  SEOther  journal_economicss  journal_sociologyy   journal_developp  journal_publichealthh  journal_sciencee  Journalrankk  pubyearr [pweight = weight] ,   ///
backward bic fix(conss     endogeneityy)

regress fetstatR conss    health_adll  health_diseasee   Selfreportedd   ///
educ_secondary educ_yschooll NumberofEducvariabless Asiaa  ///
Individualdataa sample_otherr ///
Agee Racee  Occupationn endogeneityy  tci  ///
journal_economicss  journal_sociologyy   journal_developp  Journalrankk  pubyearr  [pweight = weight] if esample == 1, vce(cluster ID)


///////////////////////////////////////////////
//////////////  RANDOM EFFECTS  ///////////////
///////////////////////////////////////////////

replace conss = 1/reseR
replace health_adll=health_adl/reseR  
replace health_diseasee=health_disease/reseR 
replace health_mortalityy=health_mortality/reseR 
replace health_obesityy=health_obesity/reseR
replace health_depressionn=health_depression/reseR
replace Selfreportedd=Selfreported/reseR

replace educ_primaryy=educ_primary/reseR
replace educ_secondaryy=educ_secondary/reseR
replace educ_tertiaryy=educ_tertiary/reseR
replace educ_yschooll=educ_yschool/reseR

replace   NumberofEducvariabless= NumberofEducvariables/reseR

replace Europee = Europe/reseR
replace Asiaa = Asia/reseR
replace country_otherr=country_other/reseR
replace High_incomee = High_income/reseR

replace Individualdataa=Individualdata/reseR
replace panell = Panel/reseR

replace  sample_femalee= sample_female/reseR
replace  sample_malee=sample_male/reseR 
replace  sample_age25to500=sample_age25to50/reseR 
replace sample_age50abovee=sample_age50above/reseR 
replace sample_otherr=sample_other/reseR

replace Agee=Age/reseR
replace genderr=gender/reseR
replace Racee=Race/reseR
replace MaritalStatuss= MaritalStatus/reseR
replace Incomee=Income/reseR
replace Occupationn= Occupation/reseR

replace ORHRR=ORHR/reseR  
replace FGLSS= FGLS/reseR
replace ProbitLogitt= ProbitLogit/reseR 
replace HLMM=HLM/reseR
replace OrderedProbitLogitt= OrderedProbitLogit/reseR
replace IV2slsivprobitGMMM= IV2slsivprobitGMM/reseR
replace FixedEffectt= FixedEffect/seR 
replace regressiondiscontinuityy= regressiondiscontinuity/reseR 
replace ExperimentQuasi_experimentt= ExperimentQuasi_experiment /reseR
replace Other11=Other1/reseR 

replace endogeneityy= endogeneity/reseR

replace tci =  TcalculatedbyCI/seR
replace tpvalue = Tcalculatedbypvalue/reseR
replace SEOtherr = SEOther/reseR



replace journal_economicss=journal_economics/seR
replace journal_sociologyy=journal_sociology/seR  
replace journal_developp=journal_develop/seR 
replace journal_publichealthh=journal_publichealth/seR
replace journal_sciencee=journal_science/seR
replace Journalrankk=Journalrank/reseR
replace pubyearr = PubYear/reseR




// THIS SECTION GIVES EQUAL WEIGHT TO EACH OBSERVATION

*---------------------------------------------------------*
*   TABLE: RandomEffects(Weight1) // Stepwise Regression  *
*---------------------------------------------------------*

// NOTE: For Random Effects models, SE/reseR is not equal to 1. This causes a problem because the
// stepwise regression command does not have a "noconstant" option. Our solution is to run the stepwise
// regression with the constant term, then drop it in the final equation.

// Here we use backwards stepwise regression selecting on the best regression using the BIC criterion

drop esample
quietly regress retstatR conss repubbiasR  health_adll  health_diseasee health_mortalityy  health_obesityy health_depressionn  Selfreportedd   ///
educ_secondaryy  educ_tertiaryy  educ_yschooll  NumberofEducvariabless    Europee Asiaa country_otherr  High_incomee ///
Individualdataa  panell   sample_femalee   sample_malee sample_age25to500 sample_age50abovee sample_otherr  Agee genderr Racee ///
MaritalStatuss Incomee Occupationn   endogeneityy  tci tpvalue SEOther ///
journal_economicss  journal_sociologyy   journal_developp  journal_publichealthh  journal_sciencee  Journalrankk  pubyearr   


gen esample = e(sample)


vselect retstatR  repubbiasR  health_adll  health_diseasee health_mortalityy  health_obesityy health_depressionn Selfreportedd   educ_secondaryy  educ_tertiaryy  educ_yschooll  NumberofEducvariabless  ///
Europee Asiaa country_otherr  High_incomee Individualdataa    sample_femalee   sample_malee ///
sample_age25to500 sample_age50abovee sample_otherr  Agee genderr Racee  MaritalStatuss Incomee Occupationn   ///
tci  SEOther  journal_economicss  journal_sociologyy   journal_developp  journal_publichealthh  journal_sciencee  Journalrankk  pubyearr  if esample==1, ///
backward bic fix(conss      endogeneityy)


regress retstatR conss repubbiasR  health_adll  health_diseasee  ///
health_obesityy   Selfreportedd   ///
educ_secondaryy educ_tertiary educ_yschooll    country_otherr Individualdataa   ///
sample_femalee sample_malee  ///
genderr MaritalStatuss   Occupationn SEOther ///
endogeneityy   ///
journal_developp journal_sciencee Journalrankk  pubyearr   if esample == 1, noc vce(cluster ID) 

			   
			   
// THIS SECTION GIVES EQUAL WEIGHT TO EACH STUDY

*---------------------------------------------------------*
*   TABLE: RandomEffects(Weight2) // Stepwise Regression  *
*---------------------------------------------------------*

drop esample
quietly regress retstatR conss repubbiasR  health_adll  health_diseasee health_mortalityy  health_obesityy health_depressionn  Selfreportedd   ///
educ_secondaryy  educ_tertiaryy  educ_yschooll  NumberofEducvariabless    Europee Asiaa country_otherr  High_incomee ///
Individualdataa  panell   sample_femalee   sample_malee sample_age25to500 sample_age50abovee sample_otherr  Agee genderr Racee ///
MaritalStatuss Incomee Occupationn   endogeneityy  tci tpvalue SEOther ///
journal_economicss  journal_sociologyy   journal_developp  journal_publichealthh  journal_sciencee  Journalrankk  pubyearr     [pweight = weight] 

gen esample = e(sample)

vselect retstatR  repubbiasR  health_adll  health_diseasee health_mortalityy  health_obesityy health_depressionn   Selfreportedd   educ_secondaryy  educ_tertiaryy  educ_yschooll  NumberofEducvariabless  ///
Europee Asiaa country_otherr  High_incomee Individualdataa    sample_femalee   sample_malee ///
sample_age25to500 sample_age50abovee sample_otherr  Agee genderr Racee  MaritalStatuss Incomee Occupationn   ///
tci  SEOther journal_economicss  journal_sociologyy   journal_developp  journal_publichealthh  journal_sciencee  Journalrankk  pubyearr [pweight = weight] , ///
backward bic fix(conss    endogeneityy)


regress retstatR conss repubbiasR  health_adll  health_diseasee health_mortalityy ///
health_obesityy health_depressionn     ///
educ_yschooll  NumberofEducvariabless  Europee   Asiaa  country_otherr  ///
Individualdataa  sample_malee sample_otherr ///
Occupationn tci SEOther ///
endogeneityy   ///
journal_economicss  journal_sociologyy   journal_developp  Journalrankk  pubyearr [pweight = weight]  if esample == 1, noc vce(cluster ID) 


log close

 